#ifndef _LAYER_H_
#define _LAYER_H_

#include <SECore/Event.h>
#include <SECore/Signal.h>

namespace SEngine
{
    class CoreApplication;
    class Layer
    {
    public:
        Layer(CoreApplication & app) : m_app(app) {}
        virtual ~Layer() = default;
        virtual std::string Name() = 0;
        virtual void Attach() {}
        virtual void Detach() {}

        virtual void BeginFrame() {}
        virtual void EndFrame() {}
        virtual void Update(int delta) {}

        virtual void OnEvent(EventPtr) {}

        CoreApplication & GetApp() { return m_app; }

        void SetEnabled(bool value = true) { m_isEnabled = value; SignalEnabled.Invoke(value); } 
        bool IsEnabled() { return m_isEnabled; }

        template<typename T>
        T & Cast() { return static_cast<T&>(*this); }

        Signal<bool> SignalEnabled; 
        
    protected:
        CoreApplication & m_app;
        bool m_isEnabled{true};
    };
} // namespace SEngine


#endif